import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-03-30
 * Time: 14:39
 */
public class Test2 {
    public static int reverse(int number){
        String str = number+"";
        String str2 = "";
        for (int i = str.length()-1; i >= 0 ; i--) {
            char s = str.charAt(i);
            str2 = str2 + s;
        }
        return Integer.valueOf(str2);
    }
    public static boolean isPalindrome(int number){
        int number2 = reverse(number);
        if(number == number2){
            return true;
        }
        return false;
    }
    public static void main1(String[] args) {
        System.out.print("请输入一个三位以下整数:");
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        if(isPalindrome(num)){
            System.out.println("是回文数");
        }else{
            System.out.println("不是回文数");

        }
    }
    public static int suShu(int num){
        int j = 2;
        for (j = 2; j <= num ; j++) {
            if(num % j == 0 ) break;
        }
        if(num == j){
            return num;
        }
        return -1;
    }
    public static void main(String[] args) {
        int p = 0;
        int i = 2;
        while (p != 100) {
            int numSu = suShu(i);
            if(-1 == suShu(i)){
                i++;
                continue;
            }
            if(!isPalindrome(numSu)){
                if(-1 != suShu(reverse(i))){
                    System.out.print(i+" ");
                    p++;
                    if(p % 10 == 0){
                        System.out.println();
                    }
                }
            }
            i++;
        }
    }
}
